package com.dream.keigezhushou.Activity.acty.listen.myadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.dream.keigezhushou.Activity.acty.listen.PingLunActivity;
import com.dream.keigezhushou.R;

import java.util.ArrayList;

/**
 * Created by mxmf-001 on 17/3/14.
 */
public class PinglunAdapter  extends BaseAdapter{
    private Context context;
    private ArrayList<String>pinglunlist;
    private LayoutInflater inflater;


    public PinglunAdapter(Context context, ArrayList<String> pinglunlist) {
        this.context=context;
        this.pinglunlist=pinglunlist;
        this.inflater=LayoutInflater.from(context);

    }

    @Override
    public int getCount() {
        return pinglunlist.size();
    }

    @Override
    public Object getItem(int position) {
        return pinglunlist.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        if(convertView==null){
            convertView=inflater.inflate(R.layout.pinglun_item,null);
            holder=new PinglunAdapter.ViewHolder();
            holder.imageView= (ImageView) convertView.findViewById(R.id.iv_touxiang);
            holder.tvName=(TextView)convertView.findViewById(R.id.id_name);
            holder.tvTime=(TextView)convertView.findViewById(R.id.id_time);
            holder.tagcontainerLayout=convertView.findViewById(R.id.tagcontainerLayout);
            convertView.setTag(holder);

        }
        holder= (ViewHolder) convertView.getTag();
       // holder.tvName.setText(pinglunlist.get(position));
holder.tvName.setText("我们都是好孩子");
//        holder=(ThirdAdapter.ViewHolder)convertView.getTag();
//        String mms=getItem(position);
//        holder.tvSinger.setText("阿桑");
//        holder.tvTitle.setText("一直很安静");
//
//        holder.itemLinear.setOnClickListener(this);

        return convertView;


    }


    class ViewHolder{
        ImageView imageView;
        TextView tvName;
        TextView tvTime;
        View tagcontainerLayout;
    }

}
